package com.heima.confi;


import com.heima.Interceptor.LoginCheckINterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration//配置类
public class Interceptor implements WebMvcConfigurer {

    @Autowired
    private LoginCheckINterceptor loginCheckINterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //设置拦截器拦截的请求路径（ /** 表示拦截所有请求）
         registry.addInterceptor(loginCheckINterceptor).addPathPatterns("/**");
    }
}
